package 题目集.日期问题;

import java.text.ParseException;
import java.util.Scanner;
//https://www.acwing.com/file_system/file/content/whole/index/content/4186425/
public class 日期差值 {
    static int[] yearA = new int[3];
    static int[] yearB = new int[3];
    static int[] mon = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    static int getMon(int y, int m) {
        if (m == 2) {
            return isLeap(y) ? 29 : 28;
        }
        return mon[m];
    }

    public static long getTotal(int y, int m, int d) {
        long total = d;
        for (int i = 1; i < y; i++) {
            total += isLeap(i) ? 366 : 365;
        }
        for (int i = 1; i < m; i++) {
            total += getMon(y, i);
        }
        return total;
    }

    public static boolean isLeap(int y) {
        return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);
    }

    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            String a = sc.nextLine();
            String b = sc.nextLine();

            yearA[0] = Integer.parseInt(a.substring(0, 4));
            yearA[1] = Integer.parseInt(a.substring(4, 6));
            yearA[2] = Integer.parseInt(a.substring(6, 8));
            yearB[0] = Integer.parseInt(b.substring(0, 4));
            yearB[1] = Integer.parseInt(b.substring(4, 6));
            yearB[2] = Integer.parseInt(b.substring(6, 8));

            long totalA = getTotal(yearA[0], yearA[1], yearA[2]);
            long totalB = getTotal(yearB[0], yearB[1], yearB[2]);
            System.out.println(Math.abs(totalA - totalB) + 1);
        }
    }

}
